var LoadingInterceptor = function ($q,$injector,$rootScope,$state) {
    var loadingIndex = null;
    return {
        request:function(config){
            if(!config.ignoreLoadingBar || config.ignoreLoadingBar==false){
                loadingIndex = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
            }
            return config || $q.when(config);
        },
        response:function(response) {
            if(loadingIndex){
                layer.close(loadingIndex);
            }
            return response || $q.when(response);
        },
        responseError:function(rejection){
            if(loadingIndex){
                layer.close(loadingIndex);
            }
            return  $q.reject(rejection);
        }
    }
}
LoadingInterceptor.$inject=["$q","$injector","$rootScope","$state"];
export default LoadingInterceptor;